﻿using GetSlaughterItem.API.Application.Commands.Week01.Addrs;
using GetSlaughterItem.API.Application.Commands.Week01.UsersCommends;
using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using SlaughterItem.API.Application.Commands.Week01.SectionCommands;
using SlaughterItem.Common.Dtos;

namespace GetSlaughterItem.API.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class Week01GetController : ControllerBase
    {
        IMediator mediator;

        public Week01GetController(IMediator mediator)
        {
            this.mediator = mediator;
        }


        /// <summary>
        /// 用户登录
        /// </summary>
        /// <param name="cmd"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Result> UsersLosing(UserLoginCommand cmd)
        {
            return await mediator.Send(cmd);
        }

        /// <summary>
        /// 省
        /// </summary>
        /// <param name="cmd"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Result> ProvibcesShow(ProvibcesSuretenComend cmd)
        {
            return await mediator.Send(cmd);
        }

        #region 部门设置
        /// <summary>
        /// 显示部门数据
        /// </summary>
        /// <param name="cmd"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Result> ShowSectionData(SectionShowCommand cmd)
        {
            return await mediator.Send(cmd);
        }
        /// <summary>
        /// 显示部门数据 绑定下拉框
        /// </summary>
        /// <param name="cmd"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<Result> ShowSectionData1()
        {
            return await mediator.Send(new SectionShowCommand1());
        }
        #endregion
    }
}
